package day4;

public class Teacher {
	//所有的学生都具有 的属性
		//属性（描述这个事物）
		
		private int id;
		private String name;
		private int age;
		private String className;
		private double salary;
		
		//所有的学生都具有的功能
		//方法（具有的功能）
		public void printInfo() {
			
			System.out.println("该教师的id为"+id);
			System.out.println("该教师的姓名为"+name);
			System.out.println("该教师的年龄为"+age);
			System.out.println("该教师的任课班级为"+className);
		}
		
		public void teach() {
			System.out.println(name + "正在上课");
		}
		
		public void setAge(int teachAge) {
			if (teachAge > 0 && teachAge < 130) {
				this.age = teachAge;				
			}else {
				System.out.println("年龄输入错误");
			}
		}
		public int getAge() {
			
			return age;
		}

		public int getId() {
			return id;
		}

		public void setId(int id) {
			this.id = id;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getClassName() {
			return className;
		}

		public void setClassName(String className) {
			this.className = className;
		}

		@Override
		public String toString() {
			return "Teacher [id=" + id + ", name=" + name + ", age=" + age + ", className=" + className + ", salary="
					+ salary + "]";
		}

		public Teacher(int id, String name, int age, String className) {
			
			this.id = id;
			this.name = name;
			this.age = age;
			this.className = className;
			
		}

		public Teacher() {
			
			// TODO Auto-generated constructor stub
		}
		
		
}
